# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libva
pkgver=2.22.0
pkgrel=1
pkgdesc="Video Acceleration (VA) API for Linux"
url="https://01.org/linuxmedia"
arch="all"
options="!check" # No test suite.
license="MIT"
depends_dev="libx11-dev libxext-dev libxfixes-dev libdrm-dev"
makedepends="$depends_dev meson wayland-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/intel/libva/archive/$pkgver.tar.gz"

prepare() {
	( if [ -f "$startdir"/../libva-glx/APKBUILD ]; then
		_v=$pkgver
		. "$startdir"/../libva-glx/APKBUILD
		if [ "$_v" != "$pkgver" ]; then
			die "libva and libva-glx needs to be same version"
		fi
	fi )
	default_prepare
}

build() {
	abuild-meson \
		-Db_lto=true \
		-Dwith_x11=yes \
		-Dwith_glx=no \
		-Dwith_wayland=yes \
		-Dwith_win32=no \
		builddir
	meson compile -C builddir
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C builddir
}

sha512sums="
cd633e5e09eac1ed10f1fc12b0f664f836e0eda9e47c17e1295b746cfd643a18fd0564a06a148ced3cf1e2321aa4d21275918bcf8c717d3981e98a598179f370  libva-2.22.0.tar.gz
"
